﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevComponents.DotNetBar;

namespace StuMana.UI
{
    public partial class MainForm : Office2007Form
    {
        public MainForm()
        {
            InitializeComponent();
        }

        private void MainForm1_Load(object sender, EventArgs e)
        {
            this.IsMdiContainer = true;
            Connect1 frmConnect = new Connect1();
            
            frmConnect.TopLevel = false;
            frmConnect.Parent = this;
            frmConnect.Dock = DockStyle.Fill;
            frmConnect.FormBorderStyle = FormBorderStyle.None;
            this.tabControlPanelConnect.Controls.Add(frmConnect);
            this.tabControlPanelConnect.Anchor = ((AnchorStyles)((AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right)));
        //    this.tabControlPanelConnect.Dock = DockStyle.Fill;
            frmConnect.Show();


            this.IsMdiContainer = true;
            Student1 frmStudent = new Student1();
            frmStudent.TopLevel = false;
            frmStudent.Parent = this;
            frmStudent.Dock = DockStyle.Fill;
            frmStudent.FormBorderStyle = FormBorderStyle.None;
            this.tabControlPanelStudents.Controls.Add(frmStudent);
            this.tabControlPanelStudents.Anchor = ((AnchorStyles)((AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right)));
            //    this.tabControlPanelStudents.Dock = DockStyle.Fill;
            frmStudent.Show();

            this.IsMdiContainer = true;
            Activities1 frmActivities = new Activities1();
            frmActivities.TopLevel = false;
            frmActivities.Parent = this;
            frmActivities.Dock = DockStyle.Fill;
            frmActivities.FormBorderStyle = FormBorderStyle.None;
            this.tabControlPanelActivities.Controls.Add(frmActivities);
            frmActivities.Show();

            this.IsMdiContainer = true;
            CheckInOut1 frmCheckInOut = new CheckInOut1();
            frmCheckInOut.TopLevel = false;
            frmCheckInOut.Parent = this;
            frmCheckInOut.Dock = DockStyle.Fill;
            frmCheckInOut.FormBorderStyle = FormBorderStyle.None;
            this.tabControlPanelCheckInOut.Controls.Add(frmCheckInOut);
            this.tabControlPanelCheckInOut.Anchor = ((AnchorStyles)((AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right)));
           // this.tabControlPanelCheckInOut.Dock = DockStyle.Fill;
            frmCheckInOut.Show();

            this.IsMdiContainer = true;
            SchoolLate1 frmSchoolLate = new SchoolLate1();
            frmSchoolLate.TopLevel = false;
            frmSchoolLate.Parent = this;
            frmSchoolLate.Dock = DockStyle.Fill;
            frmSchoolLate.FormBorderStyle = FormBorderStyle.None;
            this.tabControlPanelSchoolLate.Controls.Add(frmSchoolLate);
            frmSchoolLate.Show();

            // Cafeteria
            //this.IsMdiContainer = true;
            //Cafeteria frmCafeteria = new Cafeteria();
            //frmCafeteria.TopLevel = false;
            //frmCafeteria.Parent = this;
            //frmCafeteria.Dock = DockStyle.Fill;
            //frmCafeteria.FormBorderStyle = FormBorderStyle.None;
            //this.tabControlPanelCafeteria.Controls.Add(frmCafeteria);
            //frmCafeteria.Show();

            this.IsMdiContainer = true;
            Cafeteria1 frmCafeteria = new Cafeteria1();
            frmCafeteria.TopLevel = false;
            frmCafeteria.Parent = this;
            frmCafeteria.Dock = DockStyle.Fill;
           // frmCafeteria.Anchor = ((AnchorStyles)((AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right)));
            frmCafeteria.FormBorderStyle = FormBorderStyle.None;
            //thay doi kich thuoc cot ban dau khi chua maximine - dat vao ham init hay gan thuoc tinh public cho form
            //int w = frmCafeteria.dgvxDanhSachFood.Size.Width;
            //int widthC = ((int)w / 4);
           
            //    frmCafeteria.dgvxDanhSachFood.Columns[0].Width = widthC;
            //    frmCafeteria.dgvxDanhSachFood.Columns[1].Width = widthC;
            //    frmCafeteria.dgvxDanhSachFood.Columns[2].Width = widthC;
            //    frmCafeteria.dgvxDanhSachFood.Columns[3].Width = widthC;
            
            this.tabControlPanelCafeteria.Controls.Add(frmCafeteria);
            frmCafeteria.Show();

              
            this.IsMdiContainer = true;
            BookStore frmBookStore = new BookStore();
            frmBookStore.TopLevel = false;
            frmBookStore.Parent = this;
            frmBookStore.Dock = DockStyle.Fill;
            frmBookStore.FormBorderStyle = FormBorderStyle.None;
            this.tabControlPanelBookStore.Controls.Add(frmBookStore);
            frmBookStore.Show();
             
            this.IsMdiContainer = true;
            Setting frmSetting = new Setting();
            frmSetting.TopLevel = false;
            frmSetting.Parent = this;
          //  frmSetting.Anchor = ((AnchorStyles)((AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right)));
            frmSetting.Dock = DockStyle.Fill;
            frmSetting.FormBorderStyle = FormBorderStyle.None;
            this.tabControlPanelSetting.Controls.Add(frmSetting);
            this.tabControlPanelSetting.Anchor = ((AnchorStyles)((AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right)));
            frmSetting.Show();

            this.IsMdiContainer = true;
            Help frmHelp = new Help();
            frmHelp.TopLevel = false;
            frmHelp.Parent = this;
            frmHelp.Dock = DockStyle.Fill;
            frmHelp.FormBorderStyle = FormBorderStyle.None;
            this.tabControlPanelHelp.Controls.Add(frmHelp);
            this.tabControlPanelHelp.Anchor = ((AnchorStyles)((AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right)));
            frmHelp.Show();

        }


        private void tabConnect_Click(object sender, EventArgs e)
        {
            this.tabControlPanelConnect.Controls.RemoveAt(0);

            this.IsMdiContainer = true;
            Connect1 frmConnect = new Connect1();
            frmConnect.TopLevel = false;
            frmConnect.Parent = this;
            frmConnect.Dock = DockStyle.Fill;
            frmConnect.FormBorderStyle = FormBorderStyle.None;
            this.tabControlPanelConnect.Controls.Add(frmConnect);
            this.tabControlPanelConnect.Anchor = ((AnchorStyles)((AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right)));

            frmConnect.Show();
        }
        private void tabStudents_Click(object sender, EventArgs e)
        {
            this.tabControlPanelStudents.Controls.RemoveAt(0);

            this.IsMdiContainer = true;
            Student1 frmStudent = new Student1();
            frmStudent.TopLevel = false;
            frmStudent.Parent = this;
            frmStudent.Dock = DockStyle.Fill;
            frmStudent.FormBorderStyle = FormBorderStyle.None;
            this.tabControlPanelStudents.Controls.Add(frmStudent);
            this.tabControlPanelStudents.Anchor = ((AnchorStyles)((AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right)));
            //    this.tabControlPanelStudents.Dock = DockStyle.Fill;
            frmStudent.Show();
        }

        private void tabActivities_Click(object sender, EventArgs e)
        {
            this.tabControlPanelActivities.Controls.RemoveAt(0);

            this.IsMdiContainer = true;
            Activities1 frmActivities = new Activities1();
            frmActivities.TopLevel = false;
            frmActivities.Parent = this;
            frmActivities.Dock = DockStyle.Fill;
            frmActivities.FormBorderStyle = FormBorderStyle.None;
            this.tabControlPanelActivities.Controls.Add(frmActivities);
            frmActivities.Show();
        }

        private void tabCheckInOut_Click(object sender, EventArgs e)
        {
            this.tabControlPanelCheckInOut.Controls.RemoveAt(0);

            this.IsMdiContainer = true;
            CheckInOut1 frmCheckInOut = new CheckInOut1();
            frmCheckInOut.TopLevel = false;
            frmCheckInOut.Parent = this;
            frmCheckInOut.Dock = DockStyle.Fill;
            frmCheckInOut.FormBorderStyle = FormBorderStyle.None;
            this.tabControlPanelCheckInOut.Controls.Add(frmCheckInOut);
            this.tabControlPanelCheckInOut.Anchor = ((AnchorStyles)((AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right)));
       
            frmCheckInOut.Show();
        }

        private void tabSchoolLate_Click(object sender, EventArgs e)
        {
            this.tabControlPanelSchoolLate.Controls.RemoveAt(0);

            this.IsMdiContainer = true;
            SchoolLate1 frmSchoolLate = new SchoolLate1();
            frmSchoolLate.TopLevel = false;
            frmSchoolLate.Parent = this;
            frmSchoolLate.Dock = DockStyle.Fill;
            frmSchoolLate.FormBorderStyle = FormBorderStyle.None;
            this.tabControlPanelSchoolLate.Controls.Add(frmSchoolLate);
            frmSchoolLate.Show();

        }

        private void tabBookStore_Click(object sender, EventArgs e)
        {
            this.tabControlPanelBookStore.Controls.RemoveAt(0);

            this.IsMdiContainer = true;
            BookStore frmBookStore = new BookStore();
            frmBookStore.TopLevel = false;
            frmBookStore.Parent = this;
            frmBookStore.Dock = DockStyle.Fill;
            frmBookStore.FormBorderStyle = FormBorderStyle.None;
            this.tabControlPanelBookStore.Controls.Add(frmBookStore);
            frmBookStore.Show();
        }

        private void tabCafeteria_Click(object sender, EventArgs e)
        {
            this.tabControlPanelCafeteria.Controls.RemoveAt(0);

            this.IsMdiContainer = true;
            Cafeteria1 frmCafeteria = new Cafeteria1();
            frmCafeteria.TopLevel = false;
            frmCafeteria.Parent = this;
            frmCafeteria.Dock = DockStyle.Fill;
            frmCafeteria.FormBorderStyle = FormBorderStyle.None;
            this.tabControlPanelCafeteria.Controls.Add(frmCafeteria);
            frmCafeteria.Show();
        }
        private void tabSetting_Click(object sender, EventArgs e)
        {
            this.tabControlPanelSetting.Controls.RemoveAt(0);

            this.IsMdiContainer = true;
            Setting frmSetting = new Setting();
            frmSetting.TopLevel = false;
            frmSetting.Parent = this;
            
            frmSetting.Dock = DockStyle.Fill;
            frmSetting.FormBorderStyle = FormBorderStyle.None;
            this.tabControlPanelSetting.Controls.Add(frmSetting);
            this.tabControlPanelSetting.Anchor = ((AnchorStyles)((AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right)));
            frmSetting.Show();
        }

       
        private void tabHelp_Click(object sender, EventArgs e)
        {
            this.tabControlPanelHelp.Controls.RemoveAt(0);

            this.IsMdiContainer = true;
            Help frmHelp = new Help();
            frmHelp.TopLevel = false;
            frmHelp.Parent = this;
            frmHelp.Dock = DockStyle.Fill;
            frmHelp.FormBorderStyle = FormBorderStyle.None;
            this.tabControlPanelHelp.Controls.Add(frmHelp);
            this.tabControlPanelHelp.Anchor = ((AnchorStyles)((AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right)));
            frmHelp.Show();
        }



        private void MainForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            Application.ExitThread();
            Application.Exit();
        }

        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            Application.ExitThread();
            Application.Exit();
        }

       
        

       

       

       

      

      
        
    }
}
